Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: support to add,update and display an address and latitude, longitude for a facility (#20) #22

Merged
merged 21 commits into from
Nov 28, 2023

Conversation

amansinghbais
Copy link
Contributor

Related Issues

Closes #20

Short Description and Why It's Useful

Implemented support to add, update and display an address and latitude, longitude for a facility.

Screenshots of Visual Changes before/after (If There Are Any)

Contribution and Currently Important Rules Acceptance

</ion-item>
</ion-content>

<ion-fab @click="saveAddress" vertical="bottom" horizontal="end" slot="fixed">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move click event to ion-fab-button

}
},
getGeoPoint(state) {
return state.current?.geoPoint ? JSON.parse(JSON.stringify(state.current.geoPoint)) : {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have used optional chaining here?

entityName: "FacilityContactDetailByPurpose",
orderBy: 'fromDate DESC',
filterByDate: 'Y',
fieldList: ['address1', 'address2', 'city', 'contactMechId', 'countryGeoName', 'latitude', 'longitude', 'postalCode', 'stateGeoName']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass viewSize as 1, as we only need a single record from this entity.

throw resp.data
}
} catch(err) {
logger.error(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.error(err)
logger.error('Failed to fetch the postal address for the facility', err)

locationTypes: {}
locationTypes: {},
countries: [],
states: []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
states: []
states: {}

@@ -2,4 +2,6 @@ export default interface UtilState {
productStores: any[];
facilityTypes: object;
locationTypes: object;
countries: any[];
states: any[];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
states: any[];
states: any;

<ion-item @keyup.enter.stop>
<ion-label>{{ translate("State") }}</ion-label>
<ion-select interface="popover" :placeholder="translate('Select')" v-model="address.stateGeoId">
<ion-select-option v-for="(state, index) in states[address.countryGeoId]" :key="index" :value="state.geoId">{{ state.geoName }}</ion-select-option>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ion-select-option v-for="(state, index) in states[address.countryGeoId]" :key="index" :value="state.geoId">{{ state.geoName }}</ion-select-option>
<ion-select-option v-for="state in states[address.countryGeoId]" :key="state.geoId" :value="state.geoId">{{ state.geoName }}</ion-select-option>

Make same changes for country ion-select.

Comment on lines 129 to 137
const payload = {
address1: this.address.address1,
address2: this.address.address2,
city: this.address.city,
countryGeoId: this.address.countryGeoId,
facilityId: this.facilityId,
postalCode: this.address.postalCode,
stateProvinceGeoId: this.address.stateGeoId
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const payload = {
address1: this.address.address1,
address2: this.address.address2,
city: this.address.city,
countryGeoId: this.address.countryGeoId,
facilityId: this.facilityId,
postalCode: this.address.postalCode,
stateProvinceGeoId: this.address.stateGeoId
}
const payload = {
...this.address,
facilityId: this.facilityId
}

<ion-content>
<form @keyup.enter="saveGeoPoint">
<ion-item class="ion-margin-bottom">
<ion-input placeholder="Zipcode" v-model="geoPoint.postalCode" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add translation for placeholder

closeModal() {
modalController.dismiss()
},
async saveAddress() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only call saveAddress if there are changes in the address

@ravilodhi ravilodhi merged commit f5e97d6 into hotwax:main Nov 28, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to add an address and edit an address and update lat lon for the facility
4 participants